#pragma once
#include "TokenType.h"
#include "Interpreter.h"

using namespace System;
using namespace System::IO;
using namespace System::Collections::Generic;

namespace squirrel
{
	namespace interpreter
	{
		public ref class PrintStatementAst : public StatementAst
		{
		private:
			String^ _Text;
		public:
			property String^ Text
			{
				String^ get()
				{
					return this->_Text;
				}
				void set(String^ value)
				{
					this->_Text = value;
				}
			}
			
			virtual void Parse(List<Token^>^ tokens, int& pos) override
			{
				Token^ firstToken = Expect(tokens, pos + 1, TokenType::String);
				this->_Text = firstToken->Text;
				pos = pos + 2;
			}
			
			virtual void Execute() override
			{
				Console::WriteLine(this->_Text);
			}

			virtual String^ ToString() override
			{
				return "PRINT '" + this->_Text + "'";
			}
		};
	}
}